package com.qfedu.service.impl;

import com.qfedu.dao.AdministratorDao;
import com.qfedu.dao.impl.AdministratorDaoImpl;
import com.qfedu.model.Administrator;
import com.qfedu.model.MilkTea;
import com.qfedu.model.User;
import com.qfedu.service.AdministratorService;

import java.util.List;

/**
 * @author han tao
 * @version 1.0
 * @date 2023/4/17 17:18
 * @project milky-tea
 */
public class AdministratorServiceImpl implements AdministratorService {
    AdministratorDao administratorDao = new AdministratorDaoImpl();

    /**
     * 管理员登录
     * @param admin
     * @return
     */
    @Override
    public Administrator login(Administrator admin) {
        return administratorDao.login(admin);
    }

    /**
     * 修改管理员信息
     * @param administrator
     * @return
     */
    @Override
    public int updateAdmin(Administrator administrator) {
        return administratorDao.updateAdmin(administrator);
    }

    /**
     * 添加奶茶
     * @param tea
     * @return
     */
    @Override
    public int addTea(MilkTea tea) {
        return administratorDao.addTea(tea);
    }

    /**
     * 修改奶茶数据
     * @param tea
     * @return
     */
    @Override
    public int updateTea(MilkTea tea) {
        return administratorDao.updateTea(tea);
    }

    /**
     * 删除奶茶
     * @param tid
     * @return
     */
    @Override
    public int deleteTea(int tid) {
        return administratorDao.deleteTea(tid);
    }

    /**
     * 查询全部奶茶
     * @return
     */
    @Override
    public List<MilkTea> findAllTea() {
        return administratorDao.findAllTea();
    }

    /**
     * 根据ID查询
     * @param tid
     * @return
     */
    @Override
    public MilkTea findTeaByTid(int tid) {
        return administratorDao.findTeaByTid(tid);
    }

    /**
     * 查询用户
     * @return
     */
    @Override
    public List<User> findAllUser() {
        return administratorDao.findAllUser();
    }

    /**
     * 修改用户数据
     * @param user
     * @return
     */
    @Override
    public int updateUserById(User user) {
        return administratorDao.updateUserById(user);
    }

    /**
     * 删除用户
     * @param id
     * @return
     */
    @Override
    public int deleteById(int id) {
        return administratorDao.deleteById(id);
    }

    /**
     * 根据ID查询
     * @param id
     * @return
     */
    @Override
    public User findUserById(int id) {
        return administratorDao.findUserById(id);
    }

    @Override
    public User findUserByName(String username) {
        return administratorDao.findUserByName(username);
    }
}
